<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"></meta>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" href="http://1.xinli2017.applinzi.com/login/css/mui.min.css"/>
    <link rel="stylesheet" href="http://1.xinli2017.applinzi.com/login/iconfont/iconfont.css">
    <link rel="stylesheet" href="http://1.xinli2017.applinzi.com/login/src/css/layui.css">

    <script src="http://1.xinli2017.applinzi.com/weixin/js/jquery.min.js"></script>
    <script src="http://1.xinli2017.applinzi.com/weixin/js/mui.min.js"></script>
    <script src="http://1.xinli2017.applinzi.com/login/src/layui.js"></script>
    <script type="text/javascript">
        document.addEventListener('plusready', function () {
            //console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"
        });
    </script>
    <style>
        body {
            font-size: 16px;
        }

        label {
            width: 10%;
        !important
        }

        input {
            height: 35px;
        }

        input[type=text] {
            border: 0;

        }

        input[placeholder] {
            font-size: 14px;
        }

        input[type=password] {
            border: 0;
        }

        input[type=button] {
            border: 0;
        }

        #mis h3 {
            text-align: center;
            padding: 10px 5px;
            font-size: 20px;
        }

        .city {
            height: auto;
            margin-bottom: 10px;
            background: #fff;
        }

        .city input[type=text] {
            margin: 0;

        }

        .city input:nth-child(2) {
            border-bottom: 1px solid #ebebeb;

        }

        .text {
            width: 100%;
            color: #FF9A4A;
            font-size: 14px;
            margin-top: 15px;
        }

        .dingdan {
            text-align: center;
            height: 50px;
            line-height: 50px;
        }

        .dingdan span {
            font-size: 14px;
        }

        .dingdan span > span {
            font-size: 18px;
            color: #FF9A4A;
            font-weight: bold;
        }

        .select {
            display: flex;
            justify-content: space-between;
            margin-top: 10px;
        }

        .select select {
            width: 49%;
            color: #333;
            font-size: 14px;
        }

        .mui-table-view:after {
            background-color: #fff;
        }

        .mui-table-view:before {
            background-color: #fff;
        }
        input[type='text']{
            margin: 10px 0 0 0;
        }
    </style>
</head>
<body style="padding: 0 15px">
<script>
        try{
            window.android.invokeMethod(0,["商铺信息补全","true"])
                }catch(e){
            console.log(e)
        }
    </script>
<!-- <header class="mui-bar mui-bar-nav" style="background: #35a4f5;">
    <button id="back" style="position:absolute;left:0;top:0;height:44px;background:#000;z-index:1000;opacity:0">返回</button>
    <a class="mui-action-back iconfont icon-fanhui mui-pull-left" style="color: #fff;font-size: 18px;line-height:44px;"></a>
    <h1 class="mui-title" style="color: #fff;">商铺信息补全</h1>
</header> -->
<div class="mui-content">
    <input type="text" placeholder="请输入商铺简称" value="" id="short_name"/>
    <input type="text" placeholder="请选择成立日期" class="layui-input" id="creation_date"  />
     
   <!--  <input style="display:none" type="text"  th:value="${securityCode}" id="securityCode"/>
    <input style="display:none" type="text"  th:value="${expiredTime}" id="expiredTime"/> -->
    <input style="display:none" type="text"  th:value="${bankBranchName}" id="bankBranchName"/>
    <input style="display:none" type="text"  th:value="${bankBranchId}" id="bankBranchId"/>
    <input style="display:none" type="text"  th:value="${provinceOfBank}" id="provinceOfBank"/>
    <input style="display:none" type="text"  th:value="${cityOfBank}" id="cityOfBank"/>
    <input style="display:none" type="text"  th:value="${bankName}" id="bankName"/>
    <input style="display:none" type="text"  th:value="${amount}" id="amount"/>
    <input style="display:none" type="text"  th:value="${ordercode}" id="ordercode"/>
    <input style="display:none" type="text"  th:value="${bankNo}" id="bankNo"/>
    <div class="select">
        <select name="" id="provinceOfShop">
            <option id="province2" value="">请选择所在省份</option>
        </select>
        <select name="" id="cityOfShop">
            <option id="city2" value="">请选择所在市/区</option>
        </select>
    </div>
    <select  id="company_type" style="margin: 0">
        <option value="" >请选择公司类型</option>
        <option value="A" >责任有限公司</option>
        <option value="B" >个体户</option>
        <option value="C" >企业非法人</option>
    </select>
    <input type="text" placeholder="请输入营业执照编号" value="" id="business_licenseno" />
    <input type="text" placeholder="请输入注册资本" value="" id="registered_capital"/>
    <div class="mui-input-row" style="width:100%;margin:15px auto;">
        <button id="btn" class="mui-btn mui-btn-primary"
            style="width:100%;height:40px;padding:15px 0;background:#35a4f5;border:0;">提交信息
        </button>
    </div>
</div>
<script  type="text/javascript">
    $(function () {
        $.ajax({
            url: 'http://106.14.214.62:80/v1.0/user/app/province/queryall',
            type: 'POST',
            dataType: 'JSON',
            success: function (data) {
                $.each(eval(data.result), function (i, item) {
                    $("#provinceOfShop").append('<option value="'+item.provinceid+'">'+item.province+'</option>');
                });
            },
            error: function () {
                console.log('加载数据异常，请重试!');
            }
        });
        function loadDevice(provinceid) {
            $.ajax({
                url: 'http://106.14.214.62:80/v1.0/user/app/city/queryall',
                type: 'POST',
                dataType: 'JSON',
                data: {
                    provinceid: provinceid
                },
                success: function (msg) {
                    console.log(msg)
                    if (msg == "{[]}") {
                        $("#cityOfShop").empty();
                    } else {
                        $("#cityOfShop").empty();
                        $("#cityOfShop").append('<option value="">请选择所在市/区</option>');
                        $.each(eval(msg.result), function (i, item) {
                            if (item.area == undefined) {
                                item.area = item.city;
                            }
                            if (item.areaid == undefined) {
                                item.areaid = item.cityid;
                            }
                            $("#cityOfShop").append('<option value="'+item.areaid+'">'+item.area+'</option>');
                        });
                    }
                },
                error: function () {
                    console.log('加载数据异常，请重试!');
                }
            });
        }
        $("#provinceOfShop").change(function () {
            loadDevice($("#provinceOfShop").val());
        });
        
        $("#btn").click(function () {

        var provinceOfShop = $("#provinceOfShop option:selected").text();
    
        var cityOfShop = $("#cityOfShop option:selected").text();
         //选中的公司类型的value
        var company_type=$("#company_type option:selected").val(); 
         //商户简称
        var short_name = $("#short_name").val();
        //注册资本
        var registered_capital = $("#registered_capital").val();
        //成立日期
        var creation_date = $("#creation_date").val();
        //营业执照编号
            var business_licenseno = $("#business_licenseno").val();
            console.log(company_type)
            console.log(short_name)
            console.log(registered_capital)
            console.log(creation_date)
            console.log(business_licenseno)
       /*  var  securityCode = $("#securityCode").val();
        var  expiredTime = $("#expiredTime").val(); */
        var  bankBranchName = $("#bankBranchName").val();
        var  bankBranchId = $("#bankBranchId").val();
        var  provinceOfBank = $("#provinceOfBank").val();
        var  cityOfBank = $("#cityOfBank").val();
        var  bankName = $("#bankName").val();
        var  amount = $("#amount").val();
        var  ordercode = $("#ordercode").val();
        var  bankNo = $("#bankNo").val();
        
            if(provinceOfShop=="请选择所在省份"||cityOfShop=="请选择所在市/区"||company_type==""||short_name=="" ||registered_capital==""||creation_date=="" ||registered_capital==""){
                    alert("请完整信息！");
                    return;
                }
            $("#btn").attr("disabled", "disabled");
            $("#btn").css({background:'#999'})
            $("#btn")[0].innerText="正在加载中..."

                  $.ajax({
                        url:"http://106.14.214.62:80/v1.0/paymentchannel/topup/sdjshops1", 
                        type:"GET", 
                        dataType: 'JSON', 
                        data: {
                            bankBranchName: bankBranchName,
                            bankBranchId: bankBranchId,
                            provinceOfBank: provinceOfBank,
                            cityOfBank: cityOfBank,
                            bankName: bankName,
                            amount: amount,
                            ordercode: ordercode,
                            company_type:company_type,
                            short_name:short_name,
                            business_licenseno:business_licenseno,
                            registered_capital:registered_capital,
                            provinceOfShop:provinceOfShop,
                            cityOfShop:cityOfShop,
                            creation_date:creation_date,
                            bankNo:bankNo
                        },
                        success: function (data) {
                            console.log(data)
                        if(data.resp_code=="success"){
                            turntopage(data.redirect_url)
                        }else{
                            alert("请重新提交")
                        } 
                        },
                        error: function (data) {
                            console.log(data)
                            alert("充值失败");
                            $('#btn').removeAttr("disabled");
                            $("#btn").css({background:'#37c3e7'})
                            $("#btn")[0].innerText="提交信息"
                        }
                    });
       
        });
        function turntopage(url){
            mui.openWindow({
            url:url,
            });
        }
        layui.use('laydate', function(){
        	  var laydate = layui.laydate;
        	    laydate.render({
        	    elem: '#creation_date'
        	    ,done: function(value, date){
        	      // console.log(value)
        	    }
  });
  });
        $('#back').click(function(){
            try{
                window.android.invokeMethod(1,["true"])
            }catch(e){
                console.log(e)
            }
       }) 
    });
</script>
</body>
</html>